home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mission to McDonaldLand
/
Mission To McDonaldLand.iso
/
calnz.dxr
/
00030_Script_LockTo
< prev
next >
Wrap
Text File
|
1998-10-25
|
2KB
|
103 lines
property myChannel,LockTo,Tracking,Permanent,LockState,OrigLoc
on birth me,myChannelP,LockToP,PermanentP,CallBackP,OrigLocP
global handcursor
set origLoc = origLocP
set lockCount = 0
set lockSate = FALSE
set myChannel = myChannelP
--lock to is of formate [lock to point:[list of rects],...]
set LockTo = LockToP
set tracking = False
set permanent = permanentP
set callback = callbackP
append(the scriptInstancelist of sprite mycHannel ,me)
append(the actorlist,me)
set the cursor of sprite mychannel = handcursor
return me
end
on stepFrame me
if tracking then
snapTo(me)
end if
end
--if user drags sprite over the lockto rect..snap loc to the lockpoint
on snapTo me
set counter =1
repeat with i in LockTo
if inside(point(the mouseh,the MouseV),i) then
set the loc of sprite myChannel= getPropAt(lockTo,counter)
if not(lockstate ) and the mouseup then
puppetsound "PieceGoesOn"
set LockState = TRUE
if permanent then
set the moveableSprite of sprite myChannel = FALSE
delFromSIlist(myChannel,me)
end if
end if
exit repeat
else
if not(lockstate) then
set the loc of sprite myChannel = point(the mouseh,the mouseV)
end if
end if
end repeat
end
--if user drags sprite over the lockto rect..snap loc to the lockpoint
on snapToCheck me
set counter =1
repeat with i in LockTo
if inside(point(the mouseh,the MouseV),i) then
return true
end if
exit repeat
end repeat
return false
end
on checkState me
return LockState
end
on Kill me
delFromSIlist(myChannel,me)
delfromactorlist(me)
set the cursor of sprite mychannel = -1
end
on mouseDown me
set tracking = TRUE
end
on mouseupOUtside me
set tracking = FALSE
end
on mouseup me
global
if permanent and snapToCheck(me) then
set LockState = TRUE
delFromSIlist(myChannel,me)
nukeObj(nuke,me)
puppetsound "pieceGoesOn"
else
set the loc of sprite myChannel = origLoc
set tracking = False
end if
end